package com.cskaoyan.gateway.controller.shopping;

import com.mall.commons.result.ResponseData;
import com.mall.commons.result.ResponseUtil;
import com.mall.shopping.IProductCateService;
import com.mall.shopping.dto.AllProductCateRequest;
import com.mall.shopping.dto.AllProductCateResponse;
import com.mall.shopping.dto.ProductCateDto;
import com.mall.user.annotation.Anoymous;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author hsp
 * @date 2021/5/24 16:31
 */
@RestController
public class CategoryController {

    @Reference(timeout = 30000,retries = 0,check = false)
    IProductCateService iProductCateService;

    @GetMapping("/shopping/categories")
    @Anoymous
    public ResponseData category(){


        AllProductCateResponse allProductCate = iProductCateService.getAllProductCate(new AllProductCateRequest());
        List<ProductCateDto> productCateDtoList = allProductCate.getProductCateDtoList();

        ResponseData objectResponseData = new ResponseUtil<>().setData(productCateDtoList);


        return objectResponseData;
    }
}
